

class ApiResponse(object):
    @staticmethod
    def success(data=None):
        res = {
            "code": 0,
            "msg": "",
            "data": data
        }
        return res

    @staticmethod
    def fail(code=-1, msg="fail"):
        res = {
            "code": code,
            "msg": msg,
            "data": None
        }
        return res

    @staticmethod
    def auth_required():
        return ApiResponse.fail(-101, msg="auth required")

    @staticmethod
    def permission_denied():
        return ApiResponse.fail(-102, msg="permission denied")